package com.buba.livenuniappservernew.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author : pzg
 * @description : Swagger配置文件
 * @date : 2023/11/23 20:26
 */
@Configuration
public class SwaggerConfig {
    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                // 禁用 Swagger UI
//                .enable(false)
                // 隐藏 Models 菜单
                .useDefaultResponseMessages(false)
                .select()
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("物联网卡平台")
                .description("物联网卡API文档")
                .version("1.0")
                .build();
    }
}
